#pragma once

#include "Action.h"
#include "PublicKey.h"
#include "SymmetricKeyInfo.h"

#include <QStringList>
#include <vector>

namespace kryptos { namespace actions {

class ActionDecrypt : public Action
{
Q_OBJECT

public:

    enum SourceType { FILE, SELECTION};

    ActionDecrypt(std::vector<unsigned char> selection, SourceType sourceType, kryptos::cryptography::PrivateKey privatekey, kryptos::entities::SymmetricKeyInfoList symkeysinfo);
    virtual ~ActionDecrypt();

    SourceType  sourceType();

    std::string decryptedSelection();


protected:
    // Action Methods
    virtual bool Prepare  ();
    virtual void RunAction();
    virtual bool Cleanup  ();

private:

    void decryptFile     ();
    void decryptSelection();

    kryptos::entities::SymmetricKeyInfo findSymmetricKeyInfo(const std::string& id);

    std::vector<unsigned char>         m_selection;
    SourceType                         m_sourceType;
    kryptos::cryptography::PrivateKey  m_privateKey;
    std::string                        m_decryptedFile, m_decryptedFileTmp, m_compressedFileName;
    std::string                        m_decryptedSelection;
    kryptos::entities::SymmetricKeyInfoList m_symkeysinfo;
};

}}
